Repository navigation
Conversation
|
Status: ready for review. CI is green on 6ad24ed (build 125952: 181 of 181 jobs passed). How each removal was checked: every removed name was searched in Five tests failed once in that build and passed on retry: |
|
Updated 9:37 AM PT - Oct 15th, 2026
✅ @robobun, your commit 6ad24edca44ba6425461c52d986cfa05b22c4fa8 passed in 🧪 To try this PR locally: bunx bun-pr 44687That installs a local version of the PR into your bun-44687 --bun |
…nd PackageJSONEditor
5b23e7a to
6ad24ed
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThe changes remove bundler result and error variants, parser warning options and checks, and reason-based CLI help handling. They also remove a redundant package replacement check and the ChangesBundler Parse Results
Bundler File Default
JavaScript Parser Warning Changes
CLI Help Output
Package JSON Replacement Check
Suggested reviewers: Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
LGTM — every removed item is provably unreachable in the current tree, and the surviving paths are byte-for-byte the same.
What was reviewed:
- Confirmed via repo-wide search that
bun_bundler::Error::{EmptyAST, ModuleNotFound},ResultValue::Empty,help_command::Reason,suppress_warnings_about_weird_code, andlatest_return_had_semicolonhave no remaining constructors/readers (remainingModuleNotFoundhits are the runtime/resolver/jsc crate enums, which are untouched;bun_transpilerre-exports the bundler enum and references neither variant). - Checked the
Reason::InvalidCommandstderr/exit-1 path in the base commit: nothing constructed it, so no dispatch path loses the "Uh-oh" message;exec()still prints to stdout and exits 0. - Verified
LinkerGraph::loadzero-fillsfilesviaset_capacity/zero/set_lenand no..Default::default()orFile::default()call exists, and that the droppedkeep_catalog_referenceterm could only be true undersubcommand == Update, which the preceding!= Updateoperand already excludes. - The esbuild-ported ASI/
!a in bwarning stubs were gated off at every call site (option alwaystrue, or an empty TODO body), so no user-visible diagnostic changes.
Extended reasoning...
The change is a single commit of pure deletions (+23/-164) across the bundler error/parse-task plumbing, the JS parser options, the CLI help command, and PackageJSONEditor, with the only non-deletion being the mechanical collapse of print_with_reason into print. It touches no security-sensitive surface. Each removed item was independently re-verified as unconstructed or unread by searching the current tree, and the base-commit help code confirmed Reason::InvalidCommand was never produced. No CODEOWNERS entry covers the changed files, the bug hunt ran dry, and there are no outstanding third-party objections in the timeline.
Behaviour change: none
Problem
Defaultimpl that nothing calls.Fix
bun bd,bun run rust:check-all(12 targets),cargo clippy, the tests in Notes, and identical bundler, transpiler and help output against the base commit's canary.Background
dead_code. But rustc countse == Error::EmptyASTas a use of the variant, and a store as a use of a field.returnthat a line break separates from its expression. Bun's parser carries the option that turns such warnings off, and no caller turns them on.Downsides
rgoversrc/,packages/andbuild/debug/codegen/, and each removed branch for a second path that reaches it.Notes
Removed, one group each
parse_task::ResultValue::Empty,bun_bundler::Error::EmptyASTandbun_bundler::Error::ModuleNotFound(33 lines).EmptyASThas no constructor: the only expression that names it isif e == crate::Error::EmptyASTinParseTask.rs, and noFromimpl or name table produces it. Thatifheld the one constructor ofResultValue::Empty. So the variant, its three match arms (source_index,drop_result_owned_fields,on_parse_task_complete) and the error variant go.ModuleNotFoundof the same enum has no constructor either. The bundler reports a missing module throughError::Resolver(bun_resolver::Error::ModuleNotFound).Options.suppress_warnings_about_weird_codeistrueinOptions::default(),Options::init, the literal insrc/bundler/transpiler.rs, and the two assignments infunction_identities.rsandpm_diff_normalize.rs.clone_for_lazy_exportcopies it. Its two readers are the ASI warning after a barereturn(parse/mod.rs) and an!a instanceof bblock whose body is aTODOcomment (parse_suffix.rs). With them goP::latest_return_had_semicolon(its one reader was the ASI block), the localreturn_without_semicolon_start, and the option. The!a in bblock ofsfx_t_inis the same emptyTODOblock without the option check, so it goes too.help_command::Reason::InvalidCommand(31 lines net,src/runtime/cli/mod.rs). Nothing constructs it.exec()and the two other callers passReason::Explicit. The enum, thereasonparameter, theUh-oh not sure what to do with that commandarm and theexit(1)branch go.print_cli_helptext!loses its printer parameter, becausepretty!is its one printer now.impl Default for linker_graph::File(14 lines). Nothing calls it.LinkerGraph::loadcreates the rows zeroed, andMultiArrayList<File>has noFile: Defaultbound.keep_catalog_referenceinPackageJSONEditor::edit(10 lines). The flag can betrueonly whenmanager.subcommand == Subcommand::Update. Its one reader is the last operand of a condition that hasmanager.subcommand != Subcommand::Updatebefore it.Open pull requests
git merge-tree) of each with this branch, against the same merge with main: no pull request that merges cleanly with main gets a conflict from this branch.return_without_semicolon_startinside the removed ASI block (group 2).drop_result_owned_fields, which loses one arm here (group 1).PackageJSONEditor.rs(group 5).print_with_reason), Make the allocation-only collection APIs infallible and drop the OOM wrappers around them #38888 (one line ofimpl Default for File), bundler: remove unsafe from bundle_v2, ParseTask, LinkerContext and the bundler thread pool #40438 (drop_result_owned_fields).Verified and left out, because an open pull request deletes or changes the same lines
Glob.scanandGlob.scanSync: One bindgen: replace bindgen v1 and v2, add classes, generate the Rust side #45104 rewritesglob.rsand removes it. An earlier version of this PR held the removal.HostProvider::from_shortcut(.., with_colon), whose one caller passesfalse: install: fix regressions and older bugs found after the package manager consolidation #45307 makes the functionpub(crate)and keeps the parameter. An earlier version of this PR held the removal.bun_bundler::cache::DISABLED, the resolver'sBundleOptions.{production, tree_shaking, allow_runtime}andresolver::Result.import_kind(all written, none read): Remove cross-crate layering workarounds #33152.os.networkInterfaces(): node:os, CompressionStream, TextEncoder/TextDecoder: remove unsafe #40244.H2FrameParser.used_window_sizeandStream.used_window_size(always 0): node:http2: keep setLocalWindowSize() off SETTINGS_INITIAL_WINDOW_SIZE #40180.MatchedRoute.needs_deinit(alwaystrue): fs_router: make MatchedRoute non-self-referential #37535.Scanner.exclusion_names(always empty): bun test: do not follow a directory link back to a directory the scan is already inside #44487.TreeContext::clear_path_trackerofbun why: bun why: print a package's dependents once, mark repeats as *deduped #37922.StmtListWhich::AllStmts: Remove dead code from bun_core, bun_jsc, bun_css, react_compiler, and two C++ bindings #40367.Nonearms ofset_buffersinnode:zlib(node:zlib: avoid aliasing compression input/output buffers #31633),Error::FailedToCopyFile(Make the Windows hardlink install backend link serially #33113),PackageWorkspaceSearchPathFormatter.quoted(Add ForeignRef<T> and make FetchHeaders the owned handle #33820), theackparameter ofH2FrameParser::send_ping(Make unrooted JSValues, views across JS re-entry, and JSC buffer-ownership contracts compile errors #34230), thelockfileparameter ofScripts::create_list(install: fold the inline default node-gyp predicates into Scripts::wants_default_node_gyp #43912, install: derive the bun.lockb meta hash in the writer #44501).Leads, not proved to the end or not removable without a conflict
Options.keep_namesandOptions.transform_onlyof the parser (parse_entry.rs) are written and never read. The removal builds on 12 targets, but it conflicts with install: fix regressions and older bugs found after the package manager consolidation #45307 and js_parser: validate TypeScript class member modifiers like esbuild #40817, which both merge cleanly today, so it is not in this PR.LinkerOptions.modeis alwaysLinkerOptionsMode::Bundle, soshould_strip_exportsinconvertStmtsForChunk.rsis alwaystrue. The removal dedents about 100 lines in a file that 18 open pull requests touch.ServerComponentParseTask::Data::ClientEntryWrapperis constructed only as the placeholder ofimpl Default. The removal needs a constructor in place of that impl.NetworkTask.apply_patch_taskis written and never read.PatchTask::new_apply_patch_hash, which builds the value, callscompute_cache_dir_and_subpath, so its side effects need a review first.@layerrules" block offindImportedFilesInCSSOrder.rsnever runs, becausewip_orderis always empty there. esbuild's version of the block appends each entry towip_order. This is a missing step of the port, not dead code.Self-review
Four concerns survived the review, and the seven proofs of the first version held when they were derived again.
bun check: fix more differences fromtsc#44685 merged, two groups and two fields that collide with pull requests that merge cleanly are out, and the list above comes from trial merges with every open pull request.!a in bblock andError::ModuleNotFoundare in.Options.keep_namesandOptions.transform_onlyare named under Leads with the reason.bun check: fix more differences fromtsc#44685, which moved a line that this PR deletes. Addressed by the rebase. That line's file no longer exists on main.mordantlint pack, not to this repository's sources.How the candidates were found
src/install,src/runtime/cli,src/runtime/api,src/bundlerand part ofsrc/runtime/node) and listed about 140 places where a value has one possible state.src/runtime/webcore,src/runtime/server, the rest ofsrc/js_parser,src/http,src/runtime/shell,src/sql,src/css, the C++ bindings andsrc/js.Verification
The base is main at 5f5799e.
bun bdpasses (debug build with ASAN).bun run rust:check-allpasses for 12 of 12 targets.cargo check --workspacepasses with--all-targets, with--cfg bun_asan --cfg bun_debug --cfg socket_fault_injection, and with--release.cargo clippy --workspaceandcargo fmt --all --checkare clean.test/bundler/bundler_edgecase.test.ts(182 pass),test/bundler/transpiler/transpiler.test.js(238 pass),test/cli/bun.test.ts(47 pass),test/cli/install/bun-update.test.ts(173 pass),test/cli/install/catalogs.test.ts(146 pass).1.4.4-canary.1+5f5799ed1):bun buildof a module graph with an empty.jsfile, a comment-only file, an empty.tsfile and an empty.jsonfile, in eight modes (default,--no-bundle,--minify,--format=cjs,--target=nodewith inline and with linked source maps,--splitting,--target=bun --minify-syntax): byte-identical output, no warning in either.Bun.Transpiler.transformSyncof five inputs with areturnbefore a line break,!a instanceof band!a in b: identical output.bun --help: the same lines, apart from the version, the random example package names, and one flag that only debug builds have.